interface StatisticsItem {
    title: string;
    enable: boolean;
    num: number;
    total: number;
}

interface CPUInfo {
    processor_num: number;
    rate_list: Array<{ time: string; rate: number }>;
}

interface MemoryInfo {
    total: string;
    used: string;
    available: string;
    rate_list: Array<{ time: string; rate: number }>;
}

interface DiskInfo {
    list: Array<{ path: string; total: string; used: string; free: string }>;
}

class NetworkInfo {
    xAxis = {
        type: 'category',
        boundaryGap: false,
        data: [],
        axisLabel: {
            rotate: 45,
        },
    };
    yAxis = {
        type: 'value',
    };
    series = [
        {
            name: '上传',
            type: 'line',
            stack: 'Total',
            data: [],
        },
        {
            name: '下载',
            type: 'line',
            stack: 'Total',
            data: [],
        },
    ];
}

export class DashboardState {
    statistics_timer: any;
    statistics_list: Array<StatisticsItem> = new Array<StatisticsItem>();
    info_timer: any;
    cpu: CPUInfo = {
        processor_num: 0,
        rate_list: [],
    };
    memory: MemoryInfo = {
        total: '',
        used: '',
        available: '',
        rate_list: [],
    };
    disk: DiskInfo = {
        list: [],
    };
    network: NetworkInfo = new NetworkInfo();
    echarts: {
        cpu: any;
        memory: any;
        disk: any;
        network: any;
    } = {
        cpu: undefined,
        memory: undefined,
        disk: undefined,
        network: undefined,
    };
    dialog: {
        sip: {
            show: boolean;
            id: string;
            domain: string;
            ip: string;
            port: string;
            password: string;
        };
    } = {
        sip: {
            show: false,
            id: '',
            domain: '',
            ip: '',
            port: '',
            password: '',
        },
    };
}
